{layout name="common/layout" /}
<div class="dislpayArrow hidden-xs"><a class="pngfix" href="javascript:void(0);" onClick="displaynavbar(this)"></a></div>

<div class="Hui-article-box" style="margin-top: 37px;">
		<div class="newCrumbs ">消息中心
				<span class="c-gray en">&gt;</span> 自提点
			</div>
	<div class="Hui-article">
		
		<div class="" >
			<div id="tab_demo" class="HuiTab cl">
				<div class="tabBar clearfix" style="float: left;"><span>系统消息</span><span>订单消息</span><span>用户留言</span></div>
				<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper no-footer" style="margin-top: 7px;float:right;">
					<div class="dataTables_length" id="DataTables_Table_0_length" style="float: none;">
						<label>
						<form action="{:url('message/showlist')}" method="get" style="width: 120px;margin-left: 30px; padding: 0 0 0 0">
							显示 
							<select id="pagesize" onchange="this.parentNode.submit()" name="DataTables_Table_0_length" aria-controls="DataTables_Table_0" class="select">
							<?php $pagesize = input('param.DataTables_Table_0_length'); ?>
								<option value="10" {if($pagesize == 10)}selected="selected"{/if}>10</option>
								<option value="25" {if($pagesize == 25)}selected="selected"{/if}>25</option>
								<option value="50" {if($pagesize == 50)}selected="selected"{/if}>50</option>
								<option value="100" {if($pagesize == 100)}selected="selected"{/if}>100</option>
							</select> 
							条
						</form>
						</label>
					</div>
				</div>	
				<div class="tabCon">
					<table class="table table-border table-bg  table-bordered" style="margin-bottom: 20px;line-height: 30px;height: 30px;">
						<tr class="text-c first-tr">
							<td>标题</td>
							<td>内容</td>
							<td>时间</td>
						</tr>
						{foreach($systemMessage as $k2 => $v2)}
						<tr  class="text-c">
							<td>{$v2['message_title']}</td>
							<td>{$v2['message_content']}</td>
							<td><?php echo date('Y-m-d H:i:s', $v2['message_create_time']); ?></td>
						</tr>
						{/foreach}
					</table>
					<div class="cl">
						{$systemMessage->render()}
					</div>
				</div>
				<div class="tabCon">
					<table class="table table-border table-bg  table-bordered" style="margin-bottom: 20px;line-height: 30px;height: 30px;">
						<tr class="text-c first-tr">
							<td>标题</td>
							<td>内容</td>
							<td>时间</td>
						</tr>
						{foreach ($orderInfo as $k =>$v)}
						<tr  class="text-c">
							<td>{$v['title']}</td>
							<td>{$v['content']}</td>
							<td><?php echo date('Y-m-d H:i:s', $v['create_time']); ?></td>
						</tr>
						{/foreach}
					</table>
					<div class="cl">
						{$orderInfo->render()}
					</div>
				</div>
				<div class="tabCon" id="user-consult">
					<table class="table table-border table-bg  table-bordered" style="margin-bottom: 20px;line-height: 30px;height: 30px;">
						<tr class="text-c first-tr">
							<td>用户昵称</td>
							<td>留言内容</td>
							<td>留言时间</td>
							<td>回复内容</td>
							<td>回复时间</td>
							<td>操作</td>
						</tr>
						{foreach ($userMessage as $k =>$v)}
						<tr class="text-c">
							<td>{$v['nickname']}</td>
							<td>{$v['content']}</td>
							<td>{$v['create_time']|date="Y-m-d H:i:s", ###}</td>
							<td>{$v['apply']}</td>
							<td>{$v['apply_time']}</td>
							<td><a class="btn reply" msg-id="{$v['id']}">回复</a></td>
						</tr>
						{/foreach}
					</table>
					<div id="modal-demo" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-dialog">
							<div class="modal-content radius" style="width:784px;">
								<div class="modal-header">
								</div>
								<form style="width:600px;border:0;">
									<div class="modal-body" >
										<textarea id="content" cols="90" rows="5" maxlength="200" placeholder="请输入回复内容"></textarea>
									</div>
									<div class="modal-footer">
										<input type="button"  value="确定" class="btn btn-primary" id="confirm">
										<button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
										<input type="hidden" id="msg-id" value="">
									</div>
								</form>
							</div>
						</div>
					</div>
					<div class="cl">
						<ul class="page"></ul>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
 
<script>
$(function(){
	$.Huitab("#tab_demo .tabBar span","#tab_demo .tabCon","current","click","0")
	
	$('#user-consult').on('click', '.reply', function(){
		var msgId = $(this).attr('msg-id');
		$('#msg-id').val(msgId);
		$("#modal-demo").modal("show")
	});
	
	$('#confirm').on('click', function(){
		var msgId = $('#msg-id').val();
		var content = $('#content').val();
		if(!content) {
			$.Huimodalalert('请输入回复内容', 2000);
			return false;
		}
		$.post("{:url('message/reply')}", {msgId:msgId, content:content}, function(res){
			if(res.status==1) {
				location.href="{:url('message/showlist')}";
			} else {
				$.Huimodalalert(res.msg, 2000);
			}
		})
	});
});
</script>
